#pragma once
#ifndef _LOGIN_SERVER_H_
#define _LOGIN_SERVER_H_
#include "Connection.h"
class CLoginClient;
class CLoginServer : public CConnection
{
protected:
	virtual xgc_void RegisteMessage();
	virtual xgc_lpvoid OnAccept( net::network_t h, xgc_long_ptr from );
	virtual xgc_void OnClose( xgc_lpvoid userdata );

public:
	xgc_void StartServer( xgc_lpcstr address, xgc_uint16 port, xgc_uint16 test_invent, xgc_uint16 timeout );
	xgc_void StopServer();

protected:
	xgc_void ProcessLogin( net::network_t h, xgc_lpvoid u, const xgc_byte* data, xgc_size size );

private:
	xgc_long_ptr mServer;

	struct Client
	{
		xgc_uint32 uid;
		net::network_t link;
		xgc_char szSession[SESSION_LEN];
	};

	typedef std::map< xgc_uint32, CLoginClient* > LoginClientMap;
	typedef std::list< CLoginClient* > FreeClientList;

	FreeClientList lstFreeClient;

};


#endif // _LOGIN_SERVER_H_